import { ref, computed } from 'vue'
// import { getSelectSession, setSelectSession } from '@/utils/storage'

const selectSessionId = ref('') // 选择会话id
const refreshSession = ref(false) // 刷新会话列表
const sendLoading = ref(false) // 是否正在等待响应

export function useChatData() {
  const setSessionId = (sessionId: string) => {
    selectSessionId.value = sessionId
    // setSelectSession(sessionId)
  }
  const setRefreshSession = (refresh: boolean) => {
    refreshSession.value = refresh
  }
  const setSendLoading = (loading: boolean) => {
    sendLoading.value = loading
  }
  const initChatData = () => {
    selectSessionId.value = ''
    // setSelectSession('')
    refreshSession.value = false
    sendLoading.value = false
  }

  return {
    selectSessionId,
    setSessionId,
    refreshSession,
    setRefreshSession,
    sendLoading,
    setSendLoading,
    initChatData
  }
}
